import { View, Image } from '@tarojs/components'
import './index.scss'
import TabBar from '@/components/TabBar'
import TopNav from './components/TopNav'
import UserContent from './components/UserContent'
import { usePageScroll } from '@tarojs/taro'
import { useState } from 'react'

export default function User() {
  const [showBg, setShowBg] = useState(false)

  usePageScroll((e: any) => {
    const { scrollTop } = e
    if (scrollTop > 130) {
      setShowBg(true)
    } else {
      setShowBg(false)
    }
    console.log('页面滚动距离', scrollTop)
  })

  return (
    <>
      <View>
        <View className="header">
          <TopNav showBg={showBg} />
          <View className="user">
            <View className="activr">
              <Image src="https://pic.imgdb.cn/item/63fca023f144a01007242e89.jpg" />
            </View>
            <View className="right">
              <View className="user_name">涵涵超人123</View>
              <View className="account">抖音号：adqqw55225</View>
            </View>
          </View>
        </View>
        <UserContent />
      </View>
      <TabBar type="my" />
    </>
  )
}
